﻿#include<opencv2/opencv.hpp>
#include<vector>
#include<iostream>
using namespace std;
using namespace cv;
int main()
{
	//Mat imagTest(Size(240, 320), CV_8UC3, Scalar(0, 255, 0));//创建一个240*320，类型为CV_8UC3，初始色彩为绿色的Mat类图像
	//Mat imagTest1(240, 320, CV_8UC3, Scalar(255, 0, 0));
	//cout << imagTest.channels()<<endl;//成员函数，返回通道
	//cout << imagTest.total() << endl;//成员函数，返回通道
	//cout << imagTest.empty() << endl;//成员函数，返回是否为空
	//cout << imagTest.rows << endl;//成员变量，行数
	//cout << imagTest.cols << endl;//成员变量，列数
	//Mat copyTest;
	//imagTest.copyTo(copyTest);
	//Mat cloneTest;
	//cloneTest = imagTest.clone();


	//Point pointTest(3, 4);
	//Point_<double> a;
	//cout << pointTest.x << endl << pointTest.y;
	//Scalar scalarTest(255, 0, 0);
	//Mat scaTest(240, 320, CV_8UC3, scalarTest);
	//Size sizeTest(240, 320);
	//Rect rectTest(5, 5, 5, 5);//起始点x， 起始点y， 宽，高
	//Rect rectTest1(pointTest, Point(pointTest.x + 5, pointTest.y + 5));//左上角点，右下角点
	//Rect rectTest2(pointTest, sizeTest);//起始点，矩形大小
	//cout << rectTest.area() <<endl<< rectTest.contains(pointTest) << endl << rectTest.size() << endl << rectTest.br() << endl << rectTest.tl();
	//
	

	vector<int> vecTest(10);
	vecTest.push_back(1);
	cout << vecTest[0];
	vector<int>::iterator itr;
	int count = 0;
	for (itr = vecTest.begin(); itr != vecTest.end(); itr++)
	{
		count++;
	}
	count = 0;
	for (auto i : vecTest)
	{
		count++;
	}
	cout << count;
	
	/*Mat imagTest(Size(240, 320), CV_8UC3, Scalar(0, 255, 0));
	ellipse(imagTest, Point(120, 160), Size(40, 60), 0,0, 360, Scalar(0, 0, 0));
	circle(imagTest, Point(120, 160), 30, Scalar(0, 0, 255));
	line(imagTest, Point(120, 0), Point(120, 320), Scalar(255, 0, 0));
	rectangle(imagTest, Point(50, 50), Point(100, 100), Scalar(255, 255, 255));*/


	//Mat prtTest(500, 500, CV_8UC3, Scalar(255, 255, 255));
	/*for (int i = 0; i < prtTest.rows; i++)
	{
		uchar* dataRow = prtTest.ptr<uchar>(i);
		for (int j = 0; j < prtTest.cols * prtTest.channels(); j++)
		{
			dataRow[j] = 0;
		}
	}*/

	//迭代器访问像素
	/*Mat_<Vec3b>::iterator itBegin = prtTest.begin<Vec3b>();
	Mat_<Vec3b>::iterator itEnd = prtTest.end<Vec3b>();
	for (;itBegin != itEnd; itBegin++)
	{
		(*itBegin)[0] = 0;
		(*itBegin)[1] = 0;
		(*itBegin)[2] = 0;
	}*/


	//Mat_<Vec3b>ptr(prtTest);
	//for (int i = 0; i < prtTest.rows; i++)
	//{
	//	for (int j = 0; j < prtTest.cols; j++)
	//	{
	//		prtTest.at<Vec3b>(i, j)[0] = 0;
	//		prtTest.at<Vec3b>(i, j)[1] = 0;
	//		prtTest.at<Vec3b>(i, j)[2] = 0;
	//		//ptr(i, j)[0] = 0;
	//		//ptr(i, j)[1] = 0;
	//		//ptr(i, j)[2] = 0;
	//	}
	//}
	cv::waitKey(0);
}